package car;

import java.util.Scanner;

public class CarTest {

	public static void main(String[] args) {
		RentCompany rent = new RentCompany("神州租车合肥分公司", "东芝路100号");
		Scanner in = new Scanner(System.in);
		rent.add(new Car("皖A-84539", "劳斯莱斯", 5, 2500));
		rent.add(new Car("皖A-845555", "江淮", 5, 800));
		rent.add(new PassengerBus("皖B-8433255", "金杯", 25, 3800));
		rent.add(new PassengerBus("皖B-222225", "金龙", 35, 4800));
		int choice = 0;
		while (true) {
			System.out.println("1:查看车辆信息，2：加车，3：出租，4：还车，9：退出");
			choice = in.nextInt();
			if (choice == 1) {
				rent.show();
			} else if (choice == 2) {
				System.out.println("什么类型，1：轿车，其他：客车");
				int type = in.nextInt();
				System.out.println("车辆基本信息：车牌，品牌，座位数，日租金：");
				String no = in.next();
				String brand = in.next();
				int seat = in.nextInt();
				int price = in.nextInt();
				Vechile newv = null;
				if (type == 1) {
					newv = new Car(no, brand, seat, price);
				} else {
					newv = new PassengerBus(no, brand, seat, price);
				}
				boolean f = rent.add(newv);
				System.out.println(f ? "新车加入成功" : "没有空余车位了，失败！");
			} else if (choice == 3) {
				System.out.println("确认要租的车型：");
				String type = in.next();
				System.out.println("租的品牌:");
				String brand = in.next();
				System.out.println("座位数：");
				int seats = in.nextInt();
				System.out.println("租几天:");
				int days = in.nextInt();
				Vechile myrent = rent.rent(type, brand, seats, days);
				if (myrent == null) {
					System.out.println("没有满足条件的车，请更改条件或者下次再来");
					continue;
				}
				System.out.println("租成功了，车辆信息如下，祝您用车愉快");
				System.out.println(myrent);
			} else if (choice == 4) {
				System.out.println("输入要还的车牌号：");
				String no = in.next();
				int monehy = rent.returnCar(no);
				System.out.println("本次要支付" + monehy + "元，欢迎下次惠顾");
			} else if (choice == 9)
				break;
		}

	}

}
